package cn.net.autocode.platform.customDict.dict;

import cn.net.autocode.core.bean.ResultT;
import cn.net.autocode.dbManager.Dao;
import cn.net.autocode.platform.customDict.CustomDict;
import cn.net.autocode.platform.customDict.CustomDictAnnotation;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.stereotype.Component;

@CustomDictAnnotation("dictGroup")
@Component("autocode_platform_dictGroup")
public class DictGroup implements CustomDict {
    private final Dao dao;

    public DictGroup(Dao dao) {
        this.dao = dao;
    }

    @Override
    public ResultT query(JSONObject param) {
        JSONArray array = dao.queryJSONArray("select distinct dict_group value,dict_group label from sys_dict order by dict_group");
        return ResultT.success(array);
    }
}
